-
Notifications
You must be signed in to change notification settings - Fork 3
Conform to nitro's DataAvailabilityProvider interface #1
base: eigenda
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cool - mostly stylistic and knits. Have a few questions and change requests 🚀
use4844 bool, | ||
useEigenDA bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: feel like an enum (e.g, DataSource
) would be the best representation for this
if use4844 { | ||
|
||
if useEigenDA { | ||
calldata, err = method.Inputs.Pack( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should prolly be checking this error
if err != nil { | ||
if config.DisableEigenDAFallbackStoreDataOnChain { | ||
log.Warn("Falling back to storing data on chain", "err", err) | ||
return false, errors.New("unable to post batch to EigenDA and fallback storing data on chain is disabled") | ||
} | ||
} | ||
|
||
pointer, err := b.eigenDAWriter.Serialize(daRef) | ||
pointer, err := b.eigenDAWriter.Serialize(blobID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not?
pointer, err := b.eigenDAWriter.Serialize(blobID) | |
sequencerMsg, err = b.eigenDAWriter.Serialize(blobID) |
sequencerMsg = pointer | ||
} | ||
|
||
data, kzgBlobs, err := b.encodeAddBatch(new(big.Int).SetUint64(batchPosition.NextSeqNum), batchPosition.MessageCount, b.building.msgCount, sequencerMsg, b.building.segments.delayedMsg, b.building.use4844) | ||
data, kzgBlobs, err := b.encodeAddBatch(new(big.Int).SetUint64(batchPosition.NextSeqNum), batchPosition.MessageCount, b.building.msgCount, sequencerMsg, b.building.segments.delayedMsg, b.building.use4844, true, blobInfo) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we be binding this boolean as a config value to the building
type?
|
||
// in the case of eigenDA the serialized data looks like this | ||
// [0-40] Header Vals | ||
// [40-41]eigenDA header flag |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
// [40-41]eigenDA header flag | |
// [40-41] eigenDA header flag |
@@ -211,3 +339,139 @@ func RecoverPayloadFromEigenDABatch(ctx context.Context, | |||
} | |||
return data, nil | |||
} | |||
|
|||
// calldata layout of sequencer msg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT - could be more readable to map this doc string into the function directly
|
||
} | ||
|
||
func convertCalldataToInt(calldata []byte) (int, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit - bytestoInt
. Calldata implies that its being fed the calldata for the whole tx
num := new(big.Int).SetBytes(calldata) | ||
|
||
if num.IsInt64() { | ||
return int(num.Uint64()), nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the reason for this casting? Could we ever receive a negative value input in this function?
"testing" | ||
) | ||
|
||
func TestParseSequencerMsg(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit - maybe we could leverage the existing nitro test helpers for this to make it more idiomatic with the repo design
@@ -0,0 +1,131 @@ | |||
package eigenda_blobs | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not at a point yet where I could comfortably review this section. Would it be worth getting one of our kzg SMEs to take a look?
Hi, we are doing some more work on further changes to the DA interface in Nitro and would welcome any feedback OffchainLabs/nitro#2157 |
new(big.Int).SetUint64(uint64(prevMsgNum)), | ||
new(big.Int).SetUint64(uint64(newMsgNum)), | ||
) | ||
kzgBlobs, err = blobs.EncodeBlobs(l2MessageData) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where do we override this? If not mistaken this is using the same encoding for 4844 blobs
go 1.20 | ||
go 1.21 | ||
|
||
toolchain go1.21.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This make error build on my docker local build
RUN go mod download
go: errors parsing go.mod:
/workspace/go.mod:5: unknown directive: toolchain
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If remove the toolchain go1.21.0
then an error on building smart contract happen as below
11.25 $ hardhat compile
22.44 Error HH411: The library eigenda, imported from src/bridge/ISequencerInbox.sol, is not installed. Try installing it using npm.
22.44 HardhatError: HH411: The library eigenda, imported from src/bridge/ISequencerInbox.sol, is not installed. Try installing it using npm.
22.44 at Resolver.resolveImport (/workspace/contracts/node_modules/hardhat/src/internal/solidity/resolver.ts:254:15)
22.44 at async /workspace/contracts/node_modules/hardhat/src/internal/solidity/dependencyGraph.ts:188:28
22.44 at async Promise.all (index 3)
22.44 at async DependencyGraph._addDependenciesFrom (/workspace/contracts/node_modules/hardhat/src/internal/solidity/dependencyGraph.ts:186:5)
22.44 at async Promise.all (index 17)
22.44 at async Function.createFromResolvedFiles (/workspace/contracts/node_modules/hardhat/src/internal/solidity/dependencyGraph.ts:15:5)
22.44 at async Environment._runTaskDefinition (/workspace/contracts/node_modules/hardhat/src/internal/core/runtime-environment.ts:333:14)
22.44 at async Environment.run (/workspace/contracts/node_modules/hardhat/src/internal/core/runtime-environment.ts:166:14)
22.44 at async SimpleTaskDefinition.action (/workspace/contracts/node_modules/hardhat/src/builtin-tasks/compile.ts:1346:58)
22.44 at async Environment._runTaskDefinition (/workspace/contracts/node_modules/hardhat/src/internal/core/runtime-environment.ts:333:14)
22.44
22.44 Caused by: HardhatError: HH401: Library eigenda is not installed.
22.44 at Resolver._resolveLibrarySourceName (/workspace/contracts/node_modules/hardhat/src/internal/solidity/resolver.ts:322:15)
22.44 at Resolver.resolveSourceName (/workspace/contracts/node_modules/hardhat/src/internal/solidity/resolver.ts:103:33)
22.44 at async Resolver.resolveImport (/workspace/contracts/node_modules/hardhat/src/internal/solidity/resolver.ts:194:24)
22.44 at async /workspace/contracts/node_modules/hardhat/src/internal/solidity/dependencyGraph.ts:188:28
22.44 at async Promise.all (index 3)
22.44 at async DependencyGraph._addDependenciesFrom (/workspace/contracts/node_modules/hardhat/src/internal/solidity/dependencyGraph.ts:186:5)
22.44 at async Promise.all (index 17)
22.44 at async Function.createFromResolvedFiles (/workspace/contracts/node_modules/hardhat/src/internal/solidity/dependencyGraph.ts:15:5)
22.44 at async Environment._runTaskDefinition (/workspace/contracts/node_modules/hardhat/src/internal/core/runtime-environment.ts:333:14)
22.44 at async Environment.run (/workspace/contracts/node_modules/hardhat/src/internal/core/runtime-environment.ts:166:14)
22.44
22.44 Caused by: Error: Cannot find module 'eigenda/package.json' from '/workspace/contracts'
22.44 at Function.resolveSync [as sync] (/workspace/contracts/node_modules/hardhat/node_modules/resolve/lib/sync.js:89:15)
22.44 at Resolver._resolveNodeModulesFileFromProjectRoot (/workspace/contracts/node_modules/hardhat/src/internal/solidity/resolver.ts:457:20)
22.44 at Resolver._resolveLibrarySourceName (/workspace/contracts/node_modules/hardhat/src/internal/solidity/resolver.ts:311:30)
22.44 at Resolver.resolveSourceName (/workspace/contracts/node_modules/hardhat/src/internal/solidity/resolver.ts:103:33)
22.44 at async Resolver.resolveImport (/workspace/contracts/node_modules/hardhat/src/internal/solidity/resolver.ts:194:24)
22.44 at async /workspace/contracts/node_modules/hardhat/src/internal/solidity/dependencyGraph.ts:188:28
22.44 at async Promise.all (index 3)
22.44 at async DependencyGraph._addDependenciesFrom (/workspace/contracts/node_modules/hardhat/src/internal/solidity/dependencyGraph.ts:186:5)
22.44 at async Promise.all (index 17)
22.44 at async Function.createFromResolvedFiles (/workspace/contracts/node_modules/hardhat/src/internal/solidity/dependencyGraph.ts:15:5)
22.47
22.64 error Command failed with exit code 1.
22.65 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
22.69 make: *** [Makefile:336: .make/solidity] Error 1
todo: test